package com.jtny.nytb.equipment.service;

import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.jtny.component.exception.ServiceException;

import com.jtny.nytb.equipment.dto.ModelDTO;
import com.jtny.nytb.equipment.dto.device.EquipmentInfoDTO;
import com.jtny.nytb.equipment.dto.excel.ExcelEquipmentDTO;
import com.jtny.nytb.equipment.dto.excel.ExcelInstrumentDTO;
import com.jtny.nytb.equipment.dto.model.ExcelModelDTO;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;
import java.util.Map;

/**
 * @author 智慧能源中心 - 伍天宇
 * @package com.jtny.nytb.energymonitor.equipment.service
 * @fileName ExcelService.java
 * @createTime 2023年11月23日 13:49
 * @Copyright© 2023 jtny
 * 江投能源技术研究院 版权所有
 */
@ResponseBody
public interface ExcelService {

    /**
     * 导入 Excel 模型
     *
     * @param excelModelList Excel 模型列表
     * @return {@link Map}<{@link String}, {@link ModelDTO}>
     * @throws ServiceException 服务异常
     */
    @ApiOperation("导入Excel模型")
    @ApiOperationSupport(order = 1)
    @PostMapping("import-model")
    Map<String, ModelDTO> importExcelModel(@RequestBody List<ExcelModelDTO> excelModelList) throws ServiceException;


    /**
     * Excel导入设备
     *
     * @param excelEquipmentList 设备List
     * @return {@link Map}<{@link String}, {@link EquipmentInfoDTO}> key:设备名称 value:设备信息
     * @throws ServiceException 服务异常
     */
    @ApiOperation("导入设备")
    @ApiOperationSupport(order = 2)
    @PostMapping("import-equipment")
    Map<String, EquipmentInfoDTO> importExcelEquipment(@RequestBody List<ExcelEquipmentDTO> excelEquipmentList) throws ServiceException;

    /**
     * Excel导入测量器具
     *
     * @param toSaveBatch 测量器具List
     * @return {@link Map}<{@link String}, {@link ExcelInstrumentDTO}> key:测量器具名称 value:测量器具信息
     * @throws ServiceException 服务异常
     */
    @ApiOperation("导入测量具")
    @ApiOperationSupport(order = 3)
    @PostMapping("import-instrument")
    Map<String, ExcelInstrumentDTO> importExcelInstrument(@RequestBody List<ExcelInstrumentDTO> toSaveBatch) throws ServiceException;
}
